package org.yn;

import org.mybatis.spring.annotation.MapperScan;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
import org.yn.auth.intercepter.AuthInterceptor;
import org.yn.auth.intercepter.LoginInterceptor;

@SpringBootApplication
@MapperScan("org.yn.*.mapper")
//@ServletComponentScan("org.yn.auth.listener")
public class YnApplication implements WebMvcConfigurer {

    @Autowired
    private AuthInterceptor authInterceptor;
    @Autowired
    private LoginInterceptor loginInterceptor;

    public static void main(String[] args) {
        SpringApplication.run(YnApplication.class, args);
    }

//    @Override
//    public void addInterceptors(InterceptorRegistry registry) {
//        registry.addInterceptor(authInterceptor)
//                .addPathPatterns("/**")
//                .excludePathPatterns("/Login","/LoginOut","/login"
//                        );
//    }

//        @Override
//    public void addInterceptors(InterceptorRegistry registry) {
//        registry.addInterceptor(loginInterceptor)
//                .addPathPatterns("/**") //拦截所有
//                .excludePathPatterns("/login/**","/user/register","/shop/settlement","/shop/active/**")
//                .excludePathPatterns("/verifyCode/**","/fastdfs/**")
//                .excludePathPatterns("/doc.html#","/doc.html#/**");// 放行名单
//    }
}
